package com.gma.userprofile.info.platform

import com.gma.userprofile.util.{HBaseUtil, SparkUtil}

object UserProfileChannel {
  def main(args: Array[String]): Unit = {

    //获取分区参数
    val ds = args.head

    //获取spark环境
    val spark = SparkUtil.getSparkSession

    //提取标签
    //1 IOS 2 android 3 微信小程序 4 微信公众号 5 h5
    val channelTag = spark.sql(
      s"""
         |select
         |id,
         |case
         |when member_channel=1 then 'IOS'
         |when member_channel=2 then 'android'
         |when member_channel=3 then '微信小程序'
         |when member_channel=4 then '微信公众号'
         |else 'h5' end as channel
         |from
         |dim.dim_pub_user_info_d_f
         |where ds='$ds'
         |
         |""".stripMargin)

    //保存到hbase
    HBaseUtil.tagToHBase(channelTag, "channel")

  }
}